#pragma once

#include<iostream>
#include<vector>
#include<list>
#include<deque>

namespace zrb
{
	template<class T,class Container = std::deque<T>>
	class stack
	{
	public:
		stack()
		{}

		void push(const T& val)
		{
			_con.push_back(val);
		}

		void pop()
		{
			_con.pop_back();
		}

		size_t size()
		{
			return _con.size();
		}

		bool empty()
		{
			return _con.empty();
		}

		const T& Top()
		{
			return _con.back();
		}
	private:
		Container _con;
	};
	void test1()
	{
		stack<int, std::vector<int>> s1;
		s1.push(1);
		s1.push(2);
		s1.push(3);
		s1.push(4);
		s1.push(5);

		std::cout << s1.size() << std::endl;

		while (!s1.empty())
		{
			std::cout << s1.Top() << " ";
			s1.pop();
		}
		std::cout << std::endl;
	}

	void test2()
	{
		stack<int, std::list<int>> s1;
		s1.push(1);
		s1.push(2);
		s1.push(3);
		s1.push(4);
		s1.push(5);

		std::cout << s1.size() << std::endl;

		while (!s1.empty())
		{
			std::cout << s1.Top() << " ";
			s1.pop();
		}
		std::cout << std::endl;
	}
	void test3()
	{
		stack<int> s1;
		s1.push(1);
		s1.push(2);
		s1.push(3);
		s1.push(4);
		s1.push(5);

		std::cout << s1.size() << std::endl;

		while (!s1.empty())
		{
			std::cout << s1.Top() << " ";
			s1.pop();
		}
		std::cout << std::endl;
	}
}

